package reduce.fz.com.reduce.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.squareup.picasso.Picasso;

import java.util.Random;

import reduce.fz.com.reduce.R;

/**
 * Created by qingshengzheng on 15/9/15.
 */
public class WitnessPicHorAdapter extends BaseHorizontalAdapter<WitnessPicHorAdapter.WitnessPicViewHolder,String> {
    public WitnessPicHorAdapter(Context context) {
        super(context);
    }

    @Override
    public WitnessPicViewHolder createViewHolder(ViewGroup parent) {
        View view = layoutInflater.inflate(R.layout.witness_pic_item, parent, false);
        return new WitnessPicViewHolder(view);
    }
    public static class WitnessPicViewHolder extends BaseRecycleViewHolder<String> {
        private ImageView imageView;
        private View view = null;

        public WitnessPicViewHolder(View itemView) {
            super(itemView);
            imageView = (ImageView) itemView;
        }

        @Override
        public void renderView(String data,int position) {
           // Picasso.with(context).load(data).into(imageView);
            Random random=new Random();
           Integer a= random.nextInt();
            int b=a%3;
            if(b==0)
            {
                Picasso.with(context).load(R.drawable.paobu_witness_card1).into(imageView);
            }
            else if(b==1)
            {
                Picasso.with(context).load(R.drawable.paobu_witness_card2).into(imageView);
            }
            else if(b==2)
            {
                Picasso.with(context).load(R.drawable.paobu_witness_card3).into(imageView);
            }
            else
            {
                Picasso.with(context).load(R.drawable.paobu_witness_card3).into(imageView);
            }


        }
    }
}
